package com.ysqcould.allocation.service.impl;


import com.ysqcould.allocation.domain.Poster;
import com.ysqcould.allocation.mapper.PosterMapper;
import com.ysqcould.allocation.service.IPosterService;
import com.ysqcould.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 海报模板地址Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-29
 */
@Service
public class PosterServiceImpl implements IPosterService
{
    @Autowired
    private PosterMapper posterMapper;

    /**
     * 查询海报模板地址
     * 
     * @param id 海报模板地址主键
     * @return 海报模板地址
     */
    @Override
    public Poster selectPosterById(Long id)
    {
        return posterMapper.selectPosterById(id);
    }

    /**
     * 查询海报模板地址列表
     * 
     * @param poster 海报模板地址
     * @return 海报模板地址
     */
    @Override
    public List<Poster> selectPosterList(Poster poster)
    {
        return posterMapper.selectPosterList(poster);
    }

    /**
     * 新增海报模板地址
     * 
     * @param poster 海报模板地址
     * @return 结果
     */
    @Override
    public int insertPoster(Poster poster)
    {
        poster.setCreateTime(DateUtils.getNowDate());
        return posterMapper.insertPoster(poster);
    }

    /**
     * 修改海报模板地址
     * 
     * @param poster 海报模板地址
     * @return 结果
     */
    @Override
    public int updatePoster(Poster poster)
    {
        poster.setUpdateTime(DateUtils.getNowDate());
        return posterMapper.updatePoster(poster);
    }

    /**
     * 批量删除海报模板地址
     * 
     * @param ids 需要删除的海报模板地址主键
     * @return 结果
     */
    @Override
    public int deletePosterByIds(Long[] ids)
    {
        return posterMapper.deletePosterByIds(ids);
    }

    /**
     * 删除海报模板地址信息
     * 
     * @param id 海报模板地址主键
     * @return 结果
     */
    @Override
    public int deletePosterById(Long id)
    {
        return posterMapper.deletePosterById(id);
    }

    @Override
    public int updateStatus(Poster ps) {
        Poster poster = posterMapper.selectPosterById(ps.getId());
        poster.setStatus(ps.getStatus());
        return posterMapper.updatePoster(poster);
    }
}
